/*
 * SPDX-License-Identifier: Apache-2.0
 * Copyright Red Hat Inc. and Hibernate Authors
 */
package org.hibernate.loader.ast.spi;

import org.hibernate.LockOptions;
import org.hibernate.OrderingMode;
import org.hibernate.RemovalsMode;

/**
 * Base contract for options for multi-load operations
 */
public interface MultiLoadOptions {
	/**
	 * How should entities in removed status be handled.
	 *
	 * @since 7.2
	 */
	RemovalsMode getRemovalsMode();

	/**
	 * Whether the result should be ordered relative to the order of
	 * identifiers to load.
	 *
	 * @since 7.2
	 */
	OrderingMode getOrderingMode();

	/**
	 * Should we returned entities that are scheduled for deletion.
	 *
	 * @return entities that are scheduled for deletion are returned as well.
	 *
	 * @deprecated Use {@linkplain #getRemovalsMode()} instead.
	 */
	@Deprecated(since = "7.2", forRemoval = true)
	default boolean isReturnOfDeletedEntitiesEnabled() {
		return getRemovalsMode() == RemovalsMode.INCLUDE;
	}

	/**
	 * Should the entities be returned in the same order as their associated entity identifiers were provided.
	 *
	 * @return entities follow the provided identifier order
	 *
	 * @deprecated Use {@linkplain #getOrderingMode()} instead.
	 */
	@Deprecated(since = "7.2", forRemoval = true)
	default boolean isOrderReturnEnabled() {
		return getOrderingMode() == OrderingMode.ORDERED;
	}

	/**
	 * Specify the lock options applied during loading.
	 *
	 * @return lock options applied during loading.
	 */
	LockOptions getLockOptions();

	/**
	 * Batch size to use when loading entities from the database.
	 *
	 * @return JDBC batch size
	 */
	Integer getBatchSize();
}
